<?php
class Model_Message extends MVC_MODEL {
/**
 * @var object SQL
 */
    public $oDb_message;

    public function __construct() {
        parent::__construct();
        $this->oDb_message = new Db_Message();
    }

    public function getMessageInbox() {
        return $this->oDb_message->getMessageInbox($this);
    }

    public function getMessageOutBox() {
        return $this->oDb_message->getMessageOutBox($this);
    }


    public function getListUser() {
        return $this->oDb_message->getListUser($this);
    }

    public function insertMessage() {
        $this->setData('message_date',date('Y-m-d H:i:s'));
        $this->setData('message_from',getUserIdLogin());
        return $this->oDb_message->doInsert($this->getAllData(),false);
    }

    public function updateMessage() {
        return $this->oDb_message->updateMessage($this->getAllData());
    }

    public function deleteMessage($id) {
        return $this->oDb_message->doDeleteByPK($id);
    }

    public function getInfoOutBoxMessage($id) {
        return $this->oDb_message->getInfoOutBoxMessage($id);
    }
    public function getInfoUserById($id) {
        return $this->oDb_message->getInfoUserById($id);
    }

    public function updateMessageStatus($id) {
        return $this->oDb_message->updateMessageStatus($id);
    }

    public function getListMessageBoard() {
        return $this->oDb_message->getListMessageBoard($this);
    }

}
